﻿// 出错时等待 10
exports.errorSleepTime = 10;
// 重启时间间隔，以小时为单位，0为不重启
//exports.restartTime=0.4;
exports.restartTime = 0;
exports.submit={

	host:'127.0.0.2',
	path:'/admin778899.php/data/kj'
}

exports.dbinfo={
	host:'127.0.0.1',
	port:'3306',
	user:'root',
	password:'qq255190635!@#$',
	database:'yongli'

}

exports.cp = [
  
	
	
		/**极速 1.5 赛车*/
    {
        title:'极速赛车',
        source:'BOT',
        name:'jspk10',
        enable:true,
        timer:'jspk10',

        option:{

            host:"127.0.0.2",
			
            timeout:5000,
            path: '/sylot/js_pk10',
            headers:{
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse:function(str){
            try{                                                                                              	//
                str=str.substr(0,200);	                                                                      	//
                var reg=/<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                	//
                var m;                                                                                        	//
                if(m=str.match(reg)){                                                                         	//
                    return {                                                                                  	//
                        type:72,                                                                              	//
                        time:m[3],                                                                            	//
                        number:m[1],                                                                          	//
                        data:m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            }catch(err){                                                                                      	//
                throw('极速赛车 解析数据不正确');                                                            	//
            }
        }
    },
	
	  /**极速 1.5 时时彩*/
    {
        title:'极速时时彩',
        source:'BOT',
        name:'jsssc',
        enable:true,
        timer:'jsssc',

        option:{

            host:"127.0.0.2",
			
            path: '/sylot/js_ssc',
            timeout:5000,
            headers:{
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse:function(str){
            try{                                                                                              	//
                str=str.substr(0,200);	                                                                      	//
                var reg=/<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                   	//
                var m;
                if(m=str.match(reg)){                                                                         	//
                    return {                                                                                  	//
                        type:73,                                                                              	//
                        time:m[3],                                                                            	//
                        number:m[1],                                                                          	//
                        data:m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            }catch(err){                                                                                      	//
                throw('极速时时彩 解析数据不正确');                                                            	//
            }
        }
    },
	
	
	
		 /**重庆时时彩*/
    {
        title: '重庆时时彩',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/ssc/cqssc/360.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 1,                                                                              	//
                        time: m[3],                                                                            	//
                        number: m[1],                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('重庆时时彩 解析数据不正确');                                                            	//
            }
        }
    },	
	
	

	
	
	
 /**北京PK10*/
    {
        title: '北京PK10',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/pk10/168.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 50,                                                                              	//
                        time: m[3],                                                                            	//
                        number: m[1],                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('北京PK10 解析数据不正确');                                                            	//
            }
        }
    },	
	
	
	
	
	 /**PCDD*/
    {
        title: 'PCDD',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/pcdd.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 66,                                                                              	//
                        time: m[3],                                                                            	//
                        number: m[1],                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('重庆时时彩 解析数据不正确');                                                            	//
            }
        }
    },	
	
	
	
	
	 /*广东快乐十分*/
    {
        title: '广东快乐十分',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/gdkl/168.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 60,                                                                              	//
                        time: m[3],                                                                            	//
                        number:m[1].substring(0,8) + ""+m[1].substring(8),                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('广东快乐十分 解析数据不正确');                                                            	//
            }
        }
    },	
	
	
		 /*北京快乐8*/
    {
        title: '北京快乐8',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/kl8/168.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 65,                                                                              	//
                        time: m[3],                                                                            	//
                        number:m[1].substring(0,8) + ""+m[1].substring(8),                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('北京快乐8 解析数据不正确');                                                            	//
            }
        }
    },	
	
	
	 /*北京快乐8*/
    {
        title: '北京快乐8',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/kl8/168.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 65,                                                                              	//
                        time: m[3],                                                                            	//
                        number:m[1].substring(0,8) + ""+m[1].substring(8),                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('北京快乐8 解析数据不正确');                                                            	//
            }
        }
    },	
	
	 /*江苏快3*/
    {
        title: '江苏快3',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/k3/jsk3/123.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 10,                                                                              	//
                        time: m[3],                                                                            	//
                        number:m[1].substring(2,8) + ""+m[1].substring(8),                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('江苏快3 解析数据不正确');                                                            	//
            }
        }
    },




	
	
	
	 /*重庆幸运农场*/
    {
        title: '重庆幸运农场',
        source: 'BOT',
        name: 'jslhc',
        enable: true,
        timer: 'jslhc',
        option: {
            host: "kj.fsh-weiyu.com",
            timeout: 50000,
            path: '/xml/cqklsf/168.php',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {                                                                                              	//
                str = str.substr(0, 200);	                                                                      	//
                var reg = /<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if (m = str.match(reg)) {                                                                         	//
                    return {                                                                                  	//
                        type: 61,                                                                              	//
                        time: m[3],                                                                            	//
                        number:m[1].substring(0,8) + ""+m[1].substring(8),                                                                          	//
                        data: m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            } catch (err) {                                                                                      	//
                throw('重庆幸运农场 解析数据不正确');                                                            	//
            }
        }
    },	
	
		
	 	/**幸运飞艇*/
    {
        title:'幸运飞艇',
        source:'BOT',
        name:'jspk10',
        enable:true,
        timer:'jspk10',

        option:{

            host:"kj.fsh-weiyu.com",
			
            timeout:5000,
            path: '/xml/q255190635/xyft1.php',
            headers:{
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse:function(str){
            try{                                                                                              	//
                str=str.substr(0,200);	                                                                      	//
                var reg=/<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                	//
                var m;                                                                                        	//
                if(m=str.match(reg)){                                                                         	//
                    return {                                                                                  	//
                        type:55,                                                                              	//
                        time:m[3],                                                                            	//
                        number:m[1],                                                                          	//
                        data:m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            }catch(err){                                                                                      	//
                throw('幸运飞艇 解析数据不正确');                                                            	//
            }
        }
    },
	
	
	
	
    {
        title: '幸运飞艇',
        source: '开彩网',
        name: 'mlaft',
        enable: true,
        timer: 'mlaft',

        option: {

            host: "luckyairship.com",
            timeout: 30000,
            path: '/api/getwiningnumbers.ashx',
            headers: {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse: function (str) {
            try {

                var myDate = new Date();
                var year = myDate.getFullYear();       //年
                var month = myDate.getMonth() + 1;     //月
                var day = myDate.getDate();            //日
                if (month < 10) month = "0" + month;
                if (day < 10) day = "0" + day;
                var mytime = year + "-" + month + "-" + day + " " + myDate.toLocaleTimeString();


                var m;
                var reg = /"openedPeriodNumber":(\d+?),"openedDate"[\s\S]*?"numbersArray":\["([\S]+)"],"curDate"/;
                if (m = str.match(reg)) {
                    return {
                        type: 55,
                        time: mytime,
                        number: m[1],
                        data: m[2].replace(/"/g, '')
                    };
                }
            } catch (err) {
                throw('168kai解析数据不正确');
            }
        }
    },

	
 
	
	
	
	
    /*广东11选5*/
    {
        title:'广东11选5',
        source:'BOT',
        name:'jslhc',
        enable:true,
        timer:'jslhc',

        option:{

            host:"kj.fsh-weiyu.com",
            timeout:50000,
            path: '/q255190635/11x5/gd.php',
            headers:{
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
            }
        },

        parse:function(str){
            try{                                                                                              	//
                str=str.substr(0,200);	                                                                      	//
                var reg=/<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;                    	//
                var m;                                                                                        	//
                if(m=str.match(reg)){                                                                         	//
                    return {                                                                                  	//
                        type:21,                                                                              	//
                        time:m[3],                                                                            	//
                        number:m[1].substring(2,8) + ""+m[1].substring(8),                                                                  	//
                        data:m[2]                                                                             	//
                    };                                                                                        	//
                }					                                                                          	//
            }catch(err){                                                                                      	//
                throw('广东11选5 解析数据不正确');                                                            	//
            }
        }
    },
	
	
	
	
		
];

global.log = function (log) {
    var date = new Date();
    console.log('[' + date.toLocaleDateString() + ' ' + date.toLocaleTimeString() + '] ' + log)
}

function getOption(type) {
    var host="api.1680210.com";
    var uri = "";
    switch (type) {
       
       
    }
    return {
        host: host,
        timeout: 5000,
        path: uri,
        headers: {
            "Content-Type": "application/json;charset=UTF-8",
            "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"
        }
    }
}

function getData(type, json) {
    var data = {};
    if (json.errorCode == 0 && json.result.businessCode == 0) {
        data = json.result.data;
        var numbers=data.preDrawIssue.toString();
        if(type==61){
            numbers=numbers.substr(2)
        }
        return {
            type: type,
            time: getNowTime(),
            number: numbers,
            data: data.preDrawCode,
        };
    }
}
function getNowTime() {
    var myDate = new Date();
    var year = myDate.getFullYear();       //年
    var month = myDate.getMonth() + 1;     //月
    var day = myDate.getDate();            //日
    if (month < 10) month = "0" + month;
    if (day < 10) day = "0" + day;
    var mytime = year + "-" + month + "-" + day + " " + myDate.toLocaleTimeString();
    return mytime;
}

function getFrompcdd(str, type) {
    var exp_data = /var latest_draw_result = {"red":\[([0-9\[\]\,\s"]+)\]/;
    var exp_phase = /var latest_draw_phase = '(\d+)';/;
    var exp_time = /var latest_draw_time = '([0-9\-\:\s]+)';/;
    var m_data = str.match(exp_data);
    var m_phase = str.match(exp_phase);
    var m_time = str.match(exp_time);
    if (m_data && m_phase && m_time) {
        var mytime = m_time[1];
        var mynumber = m_phase[1];
        var data = m_data[1].replace(/"/g, '');
    }
    if (!mytime || !mynumber || !data) throw new Error('PC蛋蛋数据不正确');
    data = data.split(',').sort();
    var kj1 = 0, kj2 = 0, kj3 = 0;
    for (var i = 0 in data) {
        if (i < 6) {
            kj1 += parseInt(data[i], 10);
        } else if (i >= 6 && i < 12) {
            kj2 += parseInt(data[i], 10);
        } else if (i >= 12 && i <= 17) {
            kj3 += parseInt(data[i], 10);
        }
    }
    if (kj1 >= 10) {
        kj1 = kj1.toString().substr(-1);
    }
    if (kj2 >= 10) {
        kj2 = kj2.toString().substr(-1);
    }
    if (kj3 >= 10) {
        kj3 = kj3.toString().substr(-1);
    }
    if (kj1 < 0 || kj3 < 0) throw new Error('PC蛋蛋开奖数据不正确');
    data = kj1 + ',' + kj2 + ',' + kj3;
    try {

        var data = {
            type: type,
            time: mytime,
            number: mynumber,
            data: data
        };
        //console.log(data);
        return data;
    } catch (err) {
        throw('解析PC蛋蛋数据失败');
    }

}

function getFrombjscweb(str, type){
	//console.log(str);
	str=str.substr(0,300);	
	//console.log(str);	
	var reg=/<row code="bjpk10" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1];	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}

function strCut(str, len){
	var strlen = str.length;
	if(strlen == 0) return false;
	var j = Math.ceil(strlen / len);
	var arr = Array();
	for(var i=0; i<j; i++)
		arr[i] = str.substr(i*len, len)
	return arr;
}
//幸运飞艇
function getFromxyftweb(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="mlaft" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1];
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}
//重庆时时彩
function getFromcqsscweb(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="cqssc" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1]	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}













//北京快乐8
function getFrombjkl8web(str, type){
	//console.log(str);
	str=str.substr(0,300);	
	//console.log(str);	
	var reg=/<row code="bjkl8" expect="(\d+?)" opencode="([\d\,\+]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1];
	var mydata=match[2].replace('+',',');
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}






//重庆幸运农场
function getFromcqxyncweb(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="cqklsf" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,6)+''+match[1].substr(-3,3);//期号	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}
//广东快乐十分
function getFromgdklsfweb(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="gdklsf" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(0,8)+''+match[1].substr(-2,2);//期号	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}
//广东11选5
function getFromgd11x5web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="gd11x5" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,8);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}
//北京快乐8
function getFrombjkl8web(str, type){
	//console.log(str);
	str=str.substr(0,300);	
	//console.log(str);	
	var reg=/<row code="bjkl8" expect="(\d+?)" opencode="([\d\,\+]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1];
        var mydata=match[2].substr(0,59);
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}
//江苏快3
function getFromjsk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="jsk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}






//江苏快3
function getFromnmgk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="nmgk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}





//江苏快3
function getFromfjk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="fjk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}


//江苏快3
function getFromahk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="ahk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}







//江苏快3
function getFromgxk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="gxk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}

//江苏快3
function getFromjlk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="jlk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}


//江苏快3
function getFromhubk3web(str, type){
	//console.log(str);
	str=str.substr(0,1000);	
	//console.log(str);	
	var reg=/<row code="hubk3" expect="(\d+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1].substr(2,9);	
	var mydata=match[2];
	var mytime=match[3];
	//console.log(mynumber);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}




//PC蛋蛋
function getFrompcdd(str, type){
	//console.log(str);
	str=str.substr(0,300);	
	//console.log(str);	
	var reg=/<row code="bjkl8" expect="(\d+?)" opencode="([\d\,\+]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	//console.log(match[1]);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1];
	var mydata=match[2].replace(/"/g, '');
	var mytime=match[3];

	mydata=mydata.split(',').sort();
	var kj1=0,kj2=0,kj3=0;
	for(var i=0 in mydata){
		if(i<6){
			kj1+=parseInt(mydata[i],10);
		}else if(i>=6 && i<12){
			kj2+=parseInt(mydata[i],10);
		}else if(i>=12 && i<=17){
			kj3+=parseInt(mydata[i],10);
		}	
	}
	if(kj1>=10){kj1=kj1.toString().substr(-1);}
	if(kj2>=10){kj2=kj2.toString().substr(-1);}
	if(kj3>=10){kj3=kj3.toString().substr(-1);}
	if(kj1<0 || kj3<0) throw new Error('PC蛋蛋开奖数据不正确');
	mydata=kj1+','+kj2+','+kj3;
	try{
		
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析PC蛋蛋数据失败');
	}
	
}
//六合彩
function getFromxglhcweb(str, type){
	str=str.substr(0,300);	
	//console.log(str);	
	var reg=/<row code="hk6" expect="(\d+?)" opencode="([\d\,\+]+?)" opentime="([\d\:\- ]+?)"/;
	match=str.match(reg);
	if(!match) throw new Error('数据不正确');
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mynumber=match[1];
	var mydata=match[2].replace('+',',');
	var mytime=match[3];
	//console.log(mydata);
	try{
		var data={
			type:type,
			time:mytime,
			number:mynumber,
			data:mydata
		};
		//console.log(data);
		return data;
	}catch(err){
		throw('解析数据失败');
	}
}
function getFrom360CP(str, type){

	str=str.substr(str.indexOf('<em class="red" id="open_issue">'),380);
	//console.log(str);
	var reg=/[\s\S]*?(\d+)<\/em>[\s\S].*?<ul id="open_code_list">((?:[\s\S]*?<li class=".*?">\d+<\/li>){3,5})[\s\S]*?<\/ul>/,
	match=str.match(reg);
	var myDate = new Date();
	var year = myDate.getFullYear();       //年   
    var month = myDate.getMonth() + 1;     //月   
    var day = myDate.getDate();            //日
	if(month < 10) month="0"+month;
	if(day < 10) day="0"+day;
	var mytime=year + "-" + month + "-" + day + " " +myDate.toLocaleTimeString();
	//console.log(match);
	if(match.length>1){
		if(match[1].length==7) match[1]=year+match[1].replace(/(\d{8})(\d{3})/,'$1-$2');
		if(match[1].length==6) match[1]=year+match[1].replace(/(\d{4})(\d{2})/,'$1-0$2');
		if(match[1].length==9) match[1]='20'+match[1].replace(/(\d{6})(\d{2})/,'$1-$2');
		if(match[1].length==10) match[1]=match[1].replace(/(\d{8})(\d{2})/,'$1-0$2');
		var mynumber=match[1].replace('-','');
		
		try{
			var data={
				type:type,
				time:mytime,
				number:mynumber
			}
			
			reg=/<li class=".*?">(\d+)<\/li>/g;
			data.data=match[2].match(reg).map(function(v){
				var reg=/<li class=".*?">(\d+)<\/li>/;
				return v.match(reg)[1];
			}).join(',');
			
			//console.log(data);
			return data;
		}catch(err){
			throw('解析数据失败');
		}
	}
}
